package com.mall.search.controller;

import com.mall.common.util.RespResult;
import com.mall.search.model.SeckillGoodsEs;
import com.mall.search.service.ISeckillGoodsSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Darren
 * @date 2022-09-28 14:50
 * Description：
 */
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@Api(tags = "REST - 秒杀商品ES")
@RestController
@RequestMapping(value = "/search/seckill/goods")
public class SeckillGoodsSearchController {
    private final ISeckillGoodsSearchService service;

    @PostMapping("/import")
    @ApiOperation("秒杀商品导入ES数据库")
    public RespResult add(@RequestBody SeckillGoodsEs es) {
        service.add(es);
        return RespResult.ok();
    }
}
